<template>
  <div>
    <Select filterable
            placeholder="品牌商选择"
            :max-tag-count="2"
            :value="companyId"
            :disabled="disable"
            @on-change="valueChanged">
      <Option v-for="item in bloc.paged.items" :value="item.id" :key="item.id">{{ item.name }}</Option>
    </Select>
  </div>
</template>
<script lang='ts'>
  import {Component, Prop, Vue} from 'vue-property-decorator';
  import {CompanySelectorBloc} from '@/component/bloc/CompanySelectorBloc';

  @Component
  export default class UserSelector extends Vue {
    @Prop({type: Number})
    readonly companyId!: number;
    @Prop({type: Boolean})
    readonly disable!: boolean;

    bloc = new CompanySelectorBloc();

    mounted() {
      this.bloc.load('');
    }

    valueChanged(value) {
      this.$emit('on-change', value);
    }
  }
</script>

<style lang='less'>

</style>
